<template>
	<div id="marketingListStatus" class="marketingListStatus">
		<div id="customerSubtitle" class="customerSubtitle">
			<tab>
				<tab-item :selected="page === 'getPoCustomerToday'" @on-item-click="getPoCustomerToday">今日新增</tab-item>
				<tab-item :selected="page === 'getPoCustomerAssigned'" @on-item-click="getPoCustomerAssigned">已分配</tab-item>
				<tab-item :selected="page === 'getPoCustomerNotAssigned'" @on-item-click="getPoCustomerNotAssigned">待分配</tab-item>
				<tab-item :selected="page === 'getObsoleteCustomers'" @on-item-click="getObsoleteCustomers">回收站</tab-item>
			</tab>
		</div>

		<div v-if="page == 'getPoCustomerToday'">
			<CustomerList curURL="customers/pages/getPoCustomerToday" jumpToObjectDetails="customerDetails" delRestURL="customers"></CustomerList>
		</div>
		<div v-else-if="page == 'getPoCustomerAssigned'">
			<CustomerList curURL="customers/pages/getPoCustomerAssigned" jumpToObjectDetails="customerDetails" delRestURL="customers"></CustomerList>
		</div>
		<div v-else-if="page == 'getPoCustomerNotAssigned'">
			<CustomerList curURL="customers/pages/getPoCustomerNotAssigned" jumpToObjectDetails="customerDetails" delRestURL="customers"></CustomerList>
		</div>
		<div v-else-if="page == 'getObsoleteCustomers'">
			<CustomerList curURL="customers/pages/getObsoleteCustomers" jumpToObjectDetails="customerDetails" delRestURL="customers"></CustomerList>
		</div>
	</div>
</template>

<script>
	import bus from '@/event/eventBus'
	import CustomerList from '../../../../components/mobile/scroller/scrollerSimple'
	import {Tab, TabItem} from 'vux'
	export default {
		name: "po-student-status",
		components: {
			Tab,
			TabItem,
			CustomerList
		},
		data() {
			return {
				page: 'getPoCustomerToday'
			}
		},
		beforeRouteLeave(to, from, next){

			//存储当前页面信息
			this.$store.commit('CREATE_URL_PARAMS', {name: from.name, params: this.page})
			next()
		},
		created: function () {
			bus.$emit("userDefinedEvent", 2)
			bus.$emit("barController", 1)
			bus.$emit("setTopSimpleTitle", '市场名单')

			this.$store.commit('FETCH_URL_PARAMS')
			if(this.$store.state.user.urlParamsMap != null && this.$store.state.user.urlParamsMap["marketingListStatus"] != null){
				this.page = this.$store.state.user.urlParamsMap["marketingListStatus"].params
			}
		},
		methods: {
			getPoCustomerToday() {
				this.page = 'getPoCustomerToday'
			},
			getPoCustomerAssigned() {
				this.page = 'getPoCustomerAssigned'
			},
			getPoCustomerNotAssigned() {
				this.page = 'getPoCustomerNotAssigned'
			},
			getObsoleteCustomers() {
				this.page = 'getObsoleteCustomers'
			}
		}
	}
</script>

<style scoped>
	.marketingListStatus{
		margin-top: 46px;
		margin-bottom: 100px;
	}

	.customerSubtitle {
		margin-top: 46px;
		position: relative;
		z-index: 99;
	}
</style>